<?php
namespace app\common\model;

use think\Session;
use think\Model;

class OnlineAsk extends Model
{
    protected $insert = ['create_time','auid'];

    protected function setCreateTimeAttr(){
        return time();
    }

    protected function setAuidAttr(){
        $wechat_info = session::get('wechat_info');
        return $wechat_info['id'];
    }

    public function showOnde($id){
        $result = $this->field('id,title,remark,speech')->find($id);
        return $result;
    }

    public function showList(){
        $wechat_info = session::get('wechat_info');
        $result = $this->field('id,title,remark,create_time')->where('auid',$wechat_info['id'])->where('status',1)->select();
        return $result;
    }
}